package com.xjoyt.pay.master.dao.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;

import com.xjoyt.pay.abstracts.AbstractDao;
import com.xjoyt.pay.master.dao.CompanyPreferenceRepositoryCustom;
import com.xjoyt.pay.master.po.CompanyPreference;
import com.xjoyt.pay.master.repository.CompanyPreferenceRepository;

public class CompanyPreferenceRepositoryImpl extends AbstractDao implements CompanyPreferenceRepositoryCustom {

	@Autowired
	private CompanyPreferenceRepository repository;

	@Override
	public CompanyPreference findOneByDomain(String domain) {
		Page<CompanyPreference> page = repository.findAllByDomain(domain, getFirstPageable());
		return page.hasContent() ? page.iterator().next() : null;
	}

}
